<template>
<div>
<el-breadcrumb separator='-'>
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>商品管理</el-breadcrumb-item>
<el-breadcrumb-item>商品列表</el-breadcrumb-item>
</el-breadcrumb>

<el-card>
<el-row>
<el-col :span="8">
<el-input>
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
</el-col>
<el-button>添加商品</el-button>
</el-row>

<el-table :data="tableData">
<el-table-column type="index" label="#"></el-table-column>
<el-table-column label="商品名称" prop="goods_name"></el-table-column>
<el-table-column label="商品价格（元）" prop="goods_price"></el-table-column>
<el-table-column label="商品重量" prop="goods_weight"></el-table-column>
<el-table-column label="创建时间" prop="add_time"></el-table-column>
<el-table-column label="操作"></el-table-column>
</el-table>
</el-card>
</div>
</template>

<script>
export default{
    data(){
        return{
            tableData:'',
            queryInfo:{
                query:'',
                pagenum:1,
                pagesize:2
            },
        }
    },
    methods:{
        getGoodsList(){
            this.$http.get('goods',{params:this.queryInfo}).then(data=>{
                if(data.data.meta.status !==200){
                    this.$message.error('获取商品列表失败')
                }else{
                    this.tableData = data.data.data.goods
                    console.log(this.tableData)
                }
            } )
        },
    },
    created(){
        this.getGoodsList()
        
    }
}
</script>

<style>

</style>